package com.crazyauntzhang.easyshopbackend.dao;

import com.crazyauntzhang.easyshopbackend.domain.SupplementFlow;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
@Repository
public interface SupplementFlowDao {

	void insertFlow(@Param("batchNo") String batchNo,
					@Param("batchDateTime") LocalDateTime batchDateTime,
					@Param("supplierID") String supplierID,
					@Param("itemBarcode") String itemBarcode,
					@Param("operation") Integer operation,
					@Param("quantity") Double quantity,
					@Param("purchasePrice") Double purchasePrice,
					@Param("purchaseNo") String purchaseNo);

	void updateStockAndPurchasePrice(@Param("itemBarcode") String itemBarcode,
									 @Param("quantity") Double quantity,
									 @Param("purchasePrice") Double purchasePrice,
									 @Param("operation") Integer operation);

	SupplementFlow selectFlow(@Param("batchNo") String batchNo);

	SupplementFlow selectSpecificFlow(@Param("batchNo") String batchNo,
									  @Param("itemBarcode") String itemBarcode);

	List<SupplementFlow> findFlowBySupplierID(@Param("supplierID") String supplierID);

	Double selectRestQuantity(@Param("batchNo") String batchNo,
							  @Param("itemBarcode") String itemBarcode);

}
